Learn R Programming

shapviz (version 0.9.5)

[.shapviz: Subsets "shapviz" Object

Description

Use standard square bracket subsetting to select rows and/or columns of SHAP values, feature values, and SHAP interaction values of a "shapviz" object.

Usage

# S3 method for shapviz
[(x, i, j, ...)

Value

A new object of class "shapviz".

Arguments

x

An object of class "shapviz".

i

Row subsetting.

j

Column subsetting.

...

Currently unused.

See Also

shapviz()

Examples

Run this code
S <- matrix(c(1, -1, -1, 1), ncol = 2, dimnames = list(NULL, c("x", "y")))
X <- data.frame(x = c("a", "b"), y = c(100, 10))
x <- shapviz(S, X, baseline = 4)
x[1, "x"]
x[1]
x[c(FALSE, TRUE), ]
x[, "x"]

Run the code above in your browser using DataLab